package com.xiaobaidu.common.util;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

/**配置文件工具类
 * @description
 * @auther hefaji
 * @date 2017/7/21
 */
public class PropertiesUtil {
    private final static String FILENAME = "config.properties";
    private static Properties prop ;

    static {
        try {
            prop = new Properties();
            InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream(FILENAME);
            prop.load(in);
        } catch (Exception e) {
           e.printStackTrace();
        }
    }

    public static String getValue(String key){
        String value = prop.getProperty(key);
        return StringUtil.isNUll(value)?"":value;
    }
    public static void main(String[] args) {
        System.out.println(PropertiesUtil.getValue("system.name"));
    }
}
